//
//  USImageActivityItem.m
//  us
//
//  Created by karry on 2025/5/7.
//

#import "USImageActivityItem.h"
#import <LinkPresentation/LinkPresentation.h>

@implementation USImageActivityItem

- (instancetype)initWithImage:(UIImage *)image {
    if (self = [super init]) {
        _image = image;
    }
    return self;
}

- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
    return [UIImage new];
}

- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(UIActivityType)activityType {
    return self.image;
}

- (LPLinkMetadata *)activityViewControllerLinkMetadata:(UIActivityViewController *)activityViewController {
    LPLinkMetadata *metadata = [[LPLinkMetadata alloc] init];
    metadata.title = self.title;
    
    metadata.imageProvider = [[NSItemProvider alloc] initWithObject:self.image];
    metadata.iconProvider = [[NSItemProvider alloc] initWithObject:self.image];
    
    return metadata;
}


@end
